package cn.sunxyz.behavior.memento;

/**
 * Created by yangrd on 2017/5/15.
 */
public class Client {

    public static void main(String[] args) {
        Original original = new Original("hello world");
        MementoStorage storage = new MementoStorage(original.createMemento());

        System.out.println("修改之前: " + original.getValue());
        original.setValue(" 你好 ");
        System.out.println("修改之后: " + original.getValue());

        original.restoreMemento(storage.getMemento());
        System.out.println("恢复之后: " + original.getValue());
    }
}
